// OGoMojo
// Whitemice.MOGI.RPC2.Account
// License: LGPL
// Copyright: Whitemice Consulting, 2006
// Author(s): Adam Tauno Williams (awilliam@whitemice.org)
using System;
using System.Globalization;
using Whitemice.MOGI;
using CookComputing.XmlRpc;

namespace Whitemice.MOGI.RPC2 {
	/// \brief An implementation of IAccount using XML-RPC
	public class Account : Whitemice.MOGI.RPC2.Document, IAccount {
		/// \brief Constructor
		/// \param document An XmlRpcStruct document
		/// \param server Reference to server object
		public Account(XmlRpcStruct document, Server server)
		 : base(document, server) 
		{
			server.Log.Debug("Account(document, server)");
		}
		
		public Account(string documentId, Server server)
			: base(documentId, server)
		{
			server.Log.Debug("Account(documentId, server)");
		}
		
		/// \brief returns the unique name of the document
		public override string Name 
		{
			get 
			{
				return ("Document/Account/" + Number);
			}
		}
		
		/// \brief returns the login attribute of the account
		public string Login {
			get 
			{
				return  document["login"].ToString();
			}
			set
			{
				document["login"] = value;
			}
		}
		
		/// \brief returns the version of the document
		/// \note Since the account object in XML-RPC does not provide a version
		/// number this property always returns the value 1
		public override int Version 
		{
			get 
			{
				return 1;
			}
		}
	}
}